from django.shortcuts import render
from django.views import View
from goods.models import GoodsCategory, GoodsChannel
from contents.models import ContentCategory, Content
from meiduo_mall.utils.meiduo_category import get_categories
class Contents(View):
    def get(self, request):
        categories = get_categories()
        contents_dict = {}
        contents = ContentCategory.objects.all()
        for content in contents:
            contents_dict[content.key] = content.content_set.filter(status=True).order_by('sequence')

        context = {
            'categories':categories,
            'contents':contents_dict
        }
        return render(request, 'index.html', context)
# Create your views here.
